function openPostWindow(url, data, name) {
    var tempForm = document.createElement("form");
    tempForm.id = "tempForm1";
    tempForm.method = "post";
    tempForm.action = url;
    tempForm.target = name;
    var hideInput = document.createElement("input");
    hideInput.type = "hidden";
    hideInput.name = "content";
    hideInput.value = data;
    tempForm.appendChild(hideInput);
    tempForm.attachEvent("onsubmit", function () {
        openWindow(name);
    });
    document.body.appendChild(tempForm);
    tempForm.fireEvent("onsubmit");
    tempForm.submit();
    document.body.removeChild(tempForm);
}
function openWindow(name,token) {
    myWindow = window.open(name,"_blank");

    myWindow.document.cookie="token=" + token;
    myWindow.focus();
}


function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}


function opennew() {


}

$(document).ready(function () {
    $("#printbtn").click(function () {
        var mode = 'popup';
        var close = '';
        var extraCss = '';
        var keepAttr = [];
        var headElements = '';
        var options = { mode: mode, popClose: close, extraCss: extraCss, retainAttr: keepAttr, extraHead: headElements };
        $('#printArea').printArea(options);
    });

    setCookie('tokenssssss', 'dsfdfdfdfdffddfsdfsdfsdfsdf', 3)

    $.getScript('http://www.taobao.com/go/app/tmall/login-api.php?'+ Math.random(), function(){
        console.log("the taobao.com cookie object:" + userCookie + " username:" + userCookie._nk_);
    });

    document.cookie="localtoken=llllllllcccccccccccccccccccaaaaaaaaaaaal" +";path=/;domain=localhost";
    console.log(getCookie('connect.sid'));

});